package com.tools;

import java.util.ArrayList;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import com.bean.DataAll;
import com.bean.feeds;


public class Json_All {
	public ArrayList<feeds> Json_All(String resault) {
		ArrayList<feeds> feedlist=null;
		try {
			JSONObject object=new JSONObject(resault);
			JSONObject object2 = object.getJSONObject("paramz");
			JSONArray feedsarray = object2.getJSONArray("feeds");
			feedlist=new ArrayList<feeds>();
			for (int i = 0; i < feedsarray.length(); i++) {
				JSONObject feedsObject = feedsarray.getJSONObject(i);
				feeds feeds = new feeds();
				feeds.setId(feedsObject.getString("id"));
				feeds.setOid(feedsObject.getString("oid"));
				feeds.setCategory(feedsObject.getString("category"));
				JSONObject dataobject = feedsObject.getJSONObject("data");
				DataAll datas = new DataAll();
				datas.setChanged(dataobject.getString("changed"));
				datas.setCover(dataobject.getString("cover"));
				datas.setFormat(dataobject.getString("format"));
				datas.setSubject(dataobject.getString("subject"));
				datas.setSummary(dataobject.getString("summary"));
				feeds.setDataAll(datas);
				feedlist.add(feeds);
			}
			
		} catch (JSONException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return feedlist;
	}
}
